let tonkens = {
	admin: {
		tonken:"A"
	},
	adminB: {
		tonken:"B"
	}
}


let user = [
	{
		url: "/mock/d69183aef3e9bfdd738c731a7dd37b8b/zk/login",
		method: "post",
		response: config => {//这个是mock传的option 是对象{url,type,body}
			let body=JSON.parse(config.body)
			let { username } = body//body是json字符串
			
			let tonken=tonkens[username]//模拟tonken 只有username在tonkens中存在才会返回tonken
			if (!tonken) {//tonkens中无对应用户
				
				return {
					code: 401,
					data:"登录错误"
				}
			}
			return {
				code: 200,
				data:tonken//登录成功返回tonken
			};

		}
	}
]

module.exports = user